<?php
define('EmpireCMSAdmin','1');
require_once("../class/connect.php");
require_once("../class/db_sql.php");
require_once("../class/functions.php");
require_once("../class/user.php");
require_once("../class/page_obj.php");
require_once("../class/say.php");

$link=db_connect();
$empire=new mysqlquery();
$page=$_REQUEST['p'];
$act_id=$_REQUEST['act_id']?$_REQUEST['act_id']:$_REQUEST['app_id'];
$comment_db="phome_jat_comment";
$commentType=$_REQUEST['type'];
$commentType=$commentType?$commentType:ACT_CMMNT_ID;
$nums=DbTouch($comment_db,array('app_id'=>$act_id,"type_id"=>$commentType),"count(*) as num");
if($nums['num']<=0){
	echo "<div class='data-error'>还没人评论，快点<span>抢沙发</span>吧。</div>";
	exit();
}
$page=new page_obj($page,array("itemnum"=>10,"border"=>6,"row_count"=>$nums["num"]));
$page_start=$page->arr_temp['start'];
$page_end=$page->arr_temp['end'];
$page_current=$page->current_page;
$limit_str=$page->get_limit_str();

if(!$act_id){
	echo "<div class='data-error'>系统错误</div>";
	exit();
}
$items=DbTouchAll($comment_db,array('app_id'=>$act_id,"type_id"=>$commentType),"*"," order by time desc".$limit_str);
?>
<?php
if($items){
foreach($items as $key=>$vals)
{
	$is_run=true;
	$u=getUserInfo($vals['uid']);
	$head=getUserHead($u["userpic"],69,69);
	$username=$u['username'];
	$time=qtime($vals['time']);
	$is_show=false;
?>
<div class="items">
  <div class="image"><a href="<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$vals['uid']?>" title="<?=$username?>"><img title="<?=$username?>" alt="<?=$username?>" src="<?=$head?>" height='69'></a></div>
	<dl>
	   <dt><span><?=$time?></span><a href="<?=$public_r['newsurl']?>e/member/sp/?uid=<?=$vals['uid']?>"><?=$username?></a></dt>
	   <dd>
		 <?=nl2br($vals['content']);?>
		 <p class="reply" style="display:none;"><a href="#">回复</a></p>
	   </dd>
	</dl>
   <div class="clear"></div>
</div>
<?php 
}
echo  "<ul class='page-list'><input type='hidden' value='{$nums['num']}' id='cmmt_t_num' />";
for( $i=$page_start;$i<=$page_end;$i++){
	echo "<li class='p-li' style='float:left;clear:none;'><span class=".($i==$page_current?"p-current":"p-page")." onclick='loadComment(\"{$i}\")'>{$i}</span></li>";
}
echo "</ul><div class='clear'></div>";
?>

<?
}else{echo "<div class='no-data'>还没人评论，快点<span>抢沙发</span>吧。</div>";}
?>